package JAVA300.第六章异常;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class TestThrows {
    public static void main(String[] args) throws IOException {
        ReadFile();

    }

    public static void ReadFile() throws IOException {
        FileReader reader =null;

        reader = new FileReader("/Users/hqqs/Desktop/未命名.txt");//第一个catch
        System.out.println("step1");

        char c1 = (char)reader.read();//第二个catch
        System.out.println(c1);


        if (reader!=null){
            System.out.println("step3");
            reader.close();//也需要捕获异常




        }

    }

}
